package DataStructrue.heap;


public interface MyHeap<E extends Comparable<E>> {

    E peek();

    void push(E e);

    E poll();

    int size();

    boolean isEmpty();

    void clear();

//Heap{e=[1,2,5,4,3,9,6,10,7,8], size=10}
//1
//2
//3
//4
//5
//Heap{e=[6,7,9,10,8], size=5}
//Heap{e=[86,91,87,94,92,90,88,100,97,98,93,99,95,96,89], size=15}
//86

    public static void main(String[] args) {
        MyHeap<Integer> h=new Heap<>(15,true);
        for (int i = 0; i < 10; i++) {
            h.push(10-i);
        }
        System.out.println(h);
        for (int i = 0; i < 5; i++) {
            System.out.println(h.poll());
        }
        System.out.println(h);
        for (int i = 0; i < 10; i++) {
            h.poll();
        }
        for (int i = 0; i < 20; i++) {
            h.push(100-i);
        }
        System.out.println(h);
        System.out.println(h.peek());

    }
}
